package main

import (
	"bytes"
	"encoding/binary"
	"fmt"
)

func main() {
	str := `this is a} te}st}}}







`
	b := []byte(str)
	index := bytes.LastIndex(b, []byte("}"))
	fmt.Println(index)
	fmt.Println(b[:index+1])
	fmt.Println(b)
	c := bytes.Trim(b, "\v")
	fmt.Println(c)
	fmt.Println(string(c))
}

func BytesToInt(bys []byte) int {
	byteBuff := bytes.NewBuffer(bys)
	var data int64
	binary.Read(byteBuff, binary.BigEndian, &data)
	return int(data)
}
